package com.hmall.service;

import com.hmall.mapper.MallPriceMapper;
import com.hmall.model.MallPrice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MallPriceService {
    @Autowired
    MallPriceMapper mallPriceMapper;

    public Integer add(List<MallPrice> priceList){
        return mallPriceMapper.insertList(priceList);
    }

    public Integer update(List<MallPrice> priceList){
       priceList.forEach(item-> {
           mallPriceMapper.updateByPrimaryKey(item);
       });
       return 1;
    }

    public List<MallPrice> findPriceRange(Integer productId) {
        return  mallPriceMapper.findPriceList(productId);
    }
}
